function sec3_val(){
var data = $("#DP_population").val();	

	if(isNaN($("#DP_population").val()) || data.indexOf('.')!=-1)
	{
		alert("Invalid entry! Only Integer Values are Accepted!");
		$("#DP_population").focus();
		return false;
	}
	else if($("#DP_population").val()==""){
		alert("If you have no data write 0 number");
		$("#DP_population").focus();
		return false;
	}


}

function sec1_val(){
	
	if($("#scheme_name").val()==""){
	alert("Enter scheme name");
	document.getElementById("scheme_name").focus();
	return false;
	}
	if($("#YOC").val()==0){
	alert("Select Year of Commissioning");
	document.getElementById("YOC").focus();
	return false;
	}
	
	if(isNaN($("#CC").val()))
	{
		alert("Invalid entry! Only Integer and Float Values are Accepted!");
		$("#CC").focus();
		return false;
	}
	else {
		var arr = $("#CC").val().split(".");
			if(arr[1].length > 2){
			alert("Invalid entry! Enter Only Two Digit After Decimal");
			$("#CC").focus();
			return false;
			}
	}
	if($("#scheme_sactioned").val()==0){
	alert("Select Schemes Sanctioned");
	document.getElementById("scheme_sactioned").focus();
	return false;
	}
	else if($("#scheme_sactioned").val()=="Other"){
			if($("#scheme_sactioned_other").val()==""){
			alert("Enter Other's Schemes Sanctioned Value");
			document.getElementById("scheme_sactioned_other").focus();
			return false;
			}
		
	}
	

}

function sec5_val(){
	

	
	
	if($("#OA_operational_status_other").attr("checked")){
				
		if($("#OA_operational_other").val()=="" || isNaN($("#OA_operational_other").val()) ){
		alert("Please enter Integer or Float operational value's");
		$("#OA_operational_other").focus();
		return false;
		}
		else{
				
			if($("#OA_operational_other").val().indexOf(".")!=-1){
				var arr = $("#OA_operational_other").val().split(".");
			
					if(arr[1].length > 2){
					alert("Invalid entry! Enter Only Two Digit After Decimal");
					$("#OA_operational_other").focus();
					return false;
					}
			}
		}

	}
	
	if($("#exist_report_sys_other").attr("checked")){
		if($("#report_other").val()==""){
		alert("Please enter other's existing reporting system ");
		$("#report_other").focus();
		return false;
		}
	}
	
	if($("#institutional_other_check").attr("checked")){
		if($("#institutional_other").val()==""){
			alert("Please enter other's institutional value ");
			$("#institutional_other").focus();
			return false;
		}
	}
	
	if($("#financial_other_check").attr("checked")){
		if($("#financial_other").val()==""){
			alert("Please enter other's financial value ");
			$("#financial_other").focus();
			return false;
		}
	}
	
	if($("#operational_other_check").attr("checked")){
		if($("#operational_other").val()==""){
			alert("Please enter other's operational value ");
			$("#operational_other").focus();
			return false;
		}
	}
	
	

	
}

function trigger_other(check_tag,action_tag){

	if($("#"+check_tag).attr("checked")){
	$("#"+action_tag).attr("disabled",false);
	}
	else{
	$("#"+action_tag).attr("disabled",true);
	$("#"+action_tag).val('');
	}
}

function sec6_val(){
	if(document.getElementById("Location").value == ""){
	alert("Enter Location");
	document.getElementById("Location").focus();
	return false;
	}
	if($("#Latitude").val()==""){
	alert("Enter Latitude");
	document.getElementById("Latitude").focus();
	return false;
	}
	if($("#Longitude").val()==""){
		alert("Enter Longitude");
		document.getElementById("Longitude").focus();
		return false;
	}
		if($("#cap").val()==""){
		alert("Enter Capacity(kl)");
		document.getElementById("cap").focus();
		return false;
	}
		if($("#pH").val()==""){
	alert("Enter pH");
	document.getElementById("pH").focus();
	return false;
	}
	if($("#TDS").val()==""){
	alert("Enter TDS");
	document.getElementById("TDS").focus();
	return false;
	}
	if($("#cl").val()==""){
	alert("Enter cl (mg/l");
	document.getElementById("cl").focus();
	return false;
	}
	if($("#F").val()==""){
	alert("Enter F");
	document.getElementById("F").focus();
	return false;
	}
	if($("#no3").val()==""){
	alert("Enter No.3");
	document.getElementById("no3").focus();
	return false;
	}



}

function sec4_val(){
	/*
	var twoPlacedFloat = parseFloat(document.getElementById("latitude").value).toFixed(2);
	alert(twoPlacedFloat);
	return false;
	*/
	
	
		if($("#habitation_name").val()==0){
		alert("Select Habitation");
		$("#habitation_name").focus();
		return false;
		}
	
	/*
	if(document.getElementById("Location").value == ""){
	alert("Enter Location");
	document.getElementById("Location").focus();
	return false;
	}
	if($("#Longitude").val()==""){
		alert("Enter Longitude");
		document.getElementById("Longitude").focus();
		return false;
	}
	if($("#Latitude").val()==""){
	alert("Enter Latitude");
	document.getElementById("Latitude").focus();
	return false;
	}
	
	if($("#source_status_op").attr("checked")){
			if($("#yeildMin").val()==""){
			alert("Enter yeildMin");
			document.getElementById("yeildMin").focus();
			return false;
			}
			if($("#yeildMax").val()==""){
			alert("Enter yeildMax");
			document.getElementById("yeildMax").focus();
			return false;
			}
			if($("#waterMin").val()==""){
			alert("Enter waterMin");
			document.getElementById("waterMin").focus();
			return false;
			}
			if($("#waterMax").val()==""){
			alert("Enter waterMax");
			document.getElementById("waterMax").focus();
			return false;
			}
	}
	
	if($("#pH").val()==""){
	alert("Enter pH");
	document.getElementById("pH").focus();
	return false;
	}
	if($("#TDS").val()==""){
	alert("Enter TDS");
	document.getElementById("TDS").focus();
	return false;
	}
	if($("#cl").val()==""){
	alert("Enter cl (mg/l");
	document.getElementById("cl").focus();
	return false;
	}
	if($("#F").val()==""){
	alert("Enter F");
	document.getElementById("F").focus();
	return false;
	}
	if($("#no3").val()==""){
	alert("Enter No.3");
	document.getElementById("no3").focus();
	return false;
	}
	*/
	if($("#fluctuation_min").val()!="" &&  $("#fluctuation_max").val()!="") {
		
		var minvalue = Number($("#fluctuation_min").val());
		var maxvalue = Number($("#fluctuation_max").val());
		if(minvalue > maxvalue){
			alert("Water Table Fluctuations (m) Min must less than  Water Table Fluctuations (m) Max");
			$("#fluctuation_max").focus();
			return false;
		}
	}
}


function float1(field,mini,maxi)
{
			
	var value1 = field.value;
	var arr=value1.split(".");
	if(arr[0].length>2)
	{
		alert("Invalid entry! Enter Only Two Digit before Decimal");
		field.value="";
		field.focus();
		return false;
	}
	if(value1 != "")
	{
		if (!(value1.match(/^\d*\.\d*$/)))
		{
			alert("Invalid entry! Enter Only Decimal Values (eg "+mini+".12345)");
			//field.focus();
			field.value="";
			field.focus();
			return false;
		}
	}
	
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{5}$/.test(value1))
		{
			alert("Invalid entry! Enter Only Five Digit after Decimal (eg "+mini+".12345)");
			field.value="";
			field.focus();
			return false;
		}
	}
	if(field.value<mini || field.value>maxi)
    {
		alert('Please Enter Value before Decimal in Between '+mini+'-'+maxi);
		field.value="";
		field.select();
		return false;
	}

return true;
}

function check(field,mini,maxi)
{
	var valid = "0123456789"
    var ok = "yes";
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") ok = "no";
    }
    if (ok == "no") {
    alert("Invalid entry! Only Numeric Characters are Accepted!");
	field.value="";
    //field.focus();
    field.select();
    return false;
    }
	
	var value1 = field.value;
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{1,1}$/.test(value1))
		{
			alert("Number Should be One Digit after Decimal");
			field.value="";
			field.focus();
			return false;
		}
	}
	if(field.value<mini || field.value>maxi)
    {
		alert('Please Check Entered Value');
		field.value="";
		field.select();
		return false;
	}

return true;
}

function check1(field,mini,maxi)
{
	var valid = "0123456789."
    var ok = "yes";
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") ok = "no";
    }
    if (ok == "no") {
    alert("Invalid entry! Only Numeric Characters are Accepted!");
	field.value="";
    //field.focus();
    field.select();
    return false;
    }
	
	var value1 = field.value;
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{1,1}$/.test(value1))
		{
			alert("Number Should be One Digit after Decimal");
			field.value="";
			field.focus();
			return false;
		}
	}
	if(field.value<mini || field.value>maxi)
    {
		alert('Please Check Entered Value');
		field.value="";
		field.select();
		return false;
	}

return true;
}

function float2dec(field)
{	
	var value1 = field.value;
	if(isNaN(value1))
	{
		alert("Invalid entry! Only integer and decimal values are accepted!");
		field.value="";
		field.focus();
		return false;
	}
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{2}$/.test(value1))
		{
			alert("Number should be two digit after decimal");
			field.value="";
			field.focus();
			return false;
		}
	}	
}

function int(field)
{	
	var value1 = field.value;
	if(isNaN(value1))
	{
		alert("Invalid entry! Only integer values are accepted!");
		field.value="";
		field.focus();
		return false;
	}
	if(value1.indexOf(".") != -1)
	{
		alert("Invalid entry! Only integer values are accepted!");
		field.value="";
		field.focus();
		return false;
	}	
}






